package com.example.com.uiux4.layoutex;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.ImageView;

public class FrameLayoutActivity extends Activity {

	int position = 0;
	int tempPosition = 0;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_frame_layout);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	public void slide(View v) {
		tempPosition = position;

		int ids[] = { R.id.imageView1, R.id.imageView2, R.id.imageView3,
				R.id.imageView4, R.id.imageView5 };
		if (v.getId() == R.id.button1)
			position++;
		else
			position--;

		if (position < 0)
			position = ids.length - 1;
		if (position >= ids.length)
			position = 0;

		ImageView tempv = (ImageView) findViewById(ids[tempPosition]);
		ImageView view = (ImageView) findViewById(ids[position]);

		tempv.setVisibility(View.INVISIBLE);
		view.setVisibility(View.VISIBLE);

	}

}
